/*
 /	This file is part of Answerkeys Disabler
 /
 /	Answerkeys Disabler is free software: you can redistribute it and/or modify
 /	it under the terms of the GNU General Public License as published by
 /	the Free Software Foundation, either version 3 of the License, or
 /	(at your option) any later version.
 /
 /	Answerkeys Disabler is distributed in the hope that it will be useful,
 /	but WITHOUT ANY WARRANTY; without even the implied warranty of
 /	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 /	GNU General Public License for more details.
 /
 /	You should have received a copy of the GNU General Public License
 /	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /
 /	Copyright 2008 Daan van Dijk (drvdijk@gmail.com)
 */

#pragma once

#define TAPI_FRIENDLY_NAME	TEXT("TAPIDeviceV1.0")

class CTAPIDevice
{
public:
	CTAPIDevice(void);
	virtual ~CTAPIDevice(void);

	BOOL Initialize(IN	HINSTANCE		hInstance,
					//IN	ITAPIEventSink*	pSink,
					IN	TCHAR*			pszAppName	= NULL);
	void Shutdown();
	void GetGeneralInfo(TCHAR* pszIMEI,TCHAR* pszManufacturer,TCHAR* pszModal,TCHAR* pszSubscriber,TCHAR* pszRevision);
	BOOL OpenLine(DWORD dwId = -1,DWORD dwPrivileges = LINECALLPRIVILEGE_MONITOR);
	BOOL CloseLine();

private:
	HLINEAPP		m_hLineApp;
	HLINE			m_hLine;
	DWORD			m_dwLowAPIVersion;
	DWORD			m_dwDevices;
	DWORD			m_dwCellularId;

private:
	DWORD GetCellularLineId();
	BOOL  GetLineGeneralInfo(LPLINEGENERALINFO pInfo,LPTSTR pszInfo,DWORD dwInfo,DWORD dwOffset);

private:
	static HANDLE g_hEnableHidingEvent;
	static HANDLE g_hStopHidingEvent;

	static void FAR PASCAL lineCallback(DWORD hDevice,
										DWORD dwMsg,
										DWORD dwCallbackInstance,
										DWORD dwParam1,
										DWORD dwParam2,
										DWORD dwParam3);
};